<?php

/**
 * This is the model class for table "standpipe_system".
 *
 * The followings are the available columns in table 'standpipe_system':
 * @property integer $id
 * @property string $type
 * @property integer $tank_capacity
 * @property string $tc_location
 * @property integer $siamese_intake_provided
 * @property string $sip_location
 * @property integer $size
 * @property integer $no_of_unit
 * @property integer $accessible
 * @property integer $fire_hose_cabinet_provided
 * @property integer $with_complete_accessories
 * @property string $fhc_location
 * @property integer $no_of_unit_per_floor
 * @property integer $size_of_hose
 * @property integer $length_of_hose
 * @property string $type_of_nozzle
 * @property string $date_last_tested
 * @property integer $fire_lane_provided
 * @property string $location_of_the_nearest_fire_hydrant
 * @property integer $investigation_establishment_customer_profile_id
 * @property integer $inspection_id
 *
 * The followings are the available model relations:
 * @property Inspection $inspection
 */
class StandpipeSystem extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return StandpipeSystem the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
const a = "Wet";
const b ="Dry";
public function getType(){
return array(
self::a=>"Wet",
self::b=>"Dry"
);


}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'standpipe_system';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('investigation_establishment_customer_profile_id, inspection_id', 'required'),
			array('tank_capacity, siamese_intake_provided, size, no_of_unit, accessible, fire_hose_cabinet_provided, with_complete_accessories, no_of_unit_per_floor, size_of_hose, length_of_hose, fire_lane_provided, investigation_establishment_customer_profile_id, inspection_id', 'numerical', 'integerOnly'=>true),
			array('type', 'length', 'max'=>3),
			array('tc_location, sip_location, fhc_location, type_of_nozzle, date_last_tested, location_of_the_nearest_fire_hydrant', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, type, tank_capacity, tc_location, siamese_intake_provided, sip_location, size, no_of_unit, accessible, fire_hose_cabinet_provided, with_complete_accessories, fhc_location, no_of_unit_per_floor, size_of_hose, length_of_hose, type_of_nozzle, date_last_tested, fire_lane_provided, location_of_the_nearest_fire_hydrant, investigation_establishment_customer_profile_id, inspection_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'inspection' => array(self::BELONGS_TO, 'Inspection', 'inspection_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'type' => 'Type',
			'tank_capacity' => 'Tank Capacity',
			'tc_location' => 'Tc Location',
			'siamese_intake_provided' => 'Siamese Intake Provided',
			'sip_location' => 'Sip Location',
			'size' => 'Size',
			'no_of_unit' => 'No Of Unit',
			'accessible' => 'Accessible',
			'fire_hose_cabinet_provided' => 'Fire Hose Cabinet Provided',
			'with_complete_accessories' => 'With Complete Accessories',
			'fhc_location' => 'Fhc Location',
			'no_of_unit_per_floor' => 'No Of Unit Per Floor',
			'size_of_hose' => 'Size Of Hose',
			'length_of_hose' => 'Length Of Hose',
			'type_of_nozzle' => 'Type Of Nozzle',
			'date_last_tested' => 'Date Last Tested',
			'fire_lane_provided' => 'Fire Lane Provided',
			'location_of_the_nearest_fire_hydrant' => 'Location Of The Nearest Fire Hydrant',
			'investigation_establishment_customer_profile_id' => 'Investigation Establishment Customer Profile',
			'inspection_id' => 'Inspection',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('type',$this->type,true);
		$criteria->compare('tank_capacity',$this->tank_capacity);
		$criteria->compare('tc_location',$this->tc_location,true);
		$criteria->compare('siamese_intake_provided',$this->siamese_intake_provided);
		$criteria->compare('sip_location',$this->sip_location,true);
		$criteria->compare('size',$this->size);
		$criteria->compare('no_of_unit',$this->no_of_unit);
		$criteria->compare('accessible',$this->accessible);
		$criteria->compare('fire_hose_cabinet_provided',$this->fire_hose_cabinet_provided);
		$criteria->compare('with_complete_accessories',$this->with_complete_accessories);
		$criteria->compare('fhc_location',$this->fhc_location,true);
		$criteria->compare('no_of_unit_per_floor',$this->no_of_unit_per_floor);
		$criteria->compare('size_of_hose',$this->size_of_hose);
		$criteria->compare('length_of_hose',$this->length_of_hose);
		$criteria->compare('type_of_nozzle',$this->type_of_nozzle,true);
		$criteria->compare('date_last_tested',$this->date_last_tested,true);
		$criteria->compare('fire_lane_provided',$this->fire_lane_provided);
		$criteria->compare('location_of_the_nearest_fire_hydrant',$this->location_of_the_nearest_fire_hydrant,true);
		$criteria->compare('investigation_establishment_customer_profile_id',$this->investigation_establishment_customer_profile_id);
		$criteria->compare('inspection_id',$this->inspection_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}